/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-04-03
 * Time: 17:59
 */
public class Main {
    public static Thread thread1;
    public static Thread thread2;
    public static Thread thread3;
    public static void main(String[] args) {
        thread1 = new Thread(()->{
            try {
                thread2.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
             System.out.println(Thread.currentThread().getName());
         },"a");
         //
        thread2 = new Thread(()->{
            try {
                thread3.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(Thread.currentThread().getName());
        },"b");
        //
        thread3 = new Thread(()->{
            System.out.println(Thread.currentThread().getName());
        },"c");
        //
        thread1.start();
        thread2.start();
        thread3.start();
    }
}